#include <stdio.h>
#include "datacontainer.h"
#include "common.h"
int test_main()
{

    readfile();
    User user;
    copy(user.name,"gaozijian");
    copy(user.password,"test");
    user.type=Admin;
    AddItem(UserList,user);
    AddItem(UserList,user);
    User u=GetItem(UserList,0);
    DelItem(UserList,0);
    for(int i=0;i<10000;++i)
    {
        user.name[0]='A'+i%26;
        AddItem(UserList,user);
    }
//    forEach(UserList) IndexAs(i) ValueAs(User,value)
//    {
//        printf("%s %s\n",value.name,value.password);
//    }
//    End
//    forEach(UserList) IndexAs(i) ValuePtrAs(User,value2)
//    {
//        copy(value2->password,"hhhhh");
//        printf("%s",value2->name);
//    }
//    End
//    forEach(UserList) IndexAs(i) ValueAs(User,value)
//    {
//        printf("%s %s\n",value.name,value.password);
//    }
//    End

    List_User result=Where(UserList,User,equal(value->name,"Caozijian"));
    List_User nres=Where(UserList,User,not_equal(value->name,"Aaozijian"));
    printf("A开头的:%d 非A开头:%d",result.nowlen,nres.nowlen);

    forEach(result) IndexAs(i) ValuePtrAs(User,value)
    {
        printf("%s %s\n",value->name,value->password);
        forEach(nres) IndexAs(j) ValueAs(User,value2)
        {
           if(j>2) break;
           printf("内部输出:%s\n",value2.name);
        }
        End
    }
    End
    FreeList(result);
    FreeList(nres);
    User u2=Get(UserList,User,equal(value->name,"Aaozijian"));
    writefile();


//    List_User users=Where(UserList,User,type==Admin);
//    User tuser=Find(UserList,User,type==Admin);

}
